package chapter07.servlet;

public class UserLoginDemo extends HttpServlet{
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws
            ServletException, IOException {
        User user =new User();
        try {
            BeanUtils.populate(user, req.getParameterMap());
            request.setAttribute("loginUser" , user);
            //请求转发到loginResult.jsp进行查询响应
            req.getRequestDispatcher("/loginResult.jsp").forward(req, resp);
        } catch (IllegalAccessException | InvocationTargetException e) {
            e.printStackTrace();
        }
    }
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws
            ServletException, IOException {
        doGet(req, resp);
    }